﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class Extent3d : OdGeExtents3d, OdSiShape
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public Extent3d(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.Extent3d_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(Extent3d obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~Extent3d()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_Extent3d(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdSiShape.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.Extent3d_OdSiShape_GetCPtr(this.swigCPtr.Handle));
		}

		public virtual bool contains(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.Extent3d_contains(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool intersects(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.Extent3d_intersects(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void makeHalf(int dimension, bool moveRight)
		{
			GlobalsPINVOKE.Extent3d_makeHalf(this.swigCPtr, dimension, moveRight);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void makeDouble(int dimension, bool moveRight)
		{
			GlobalsPINVOKE.Extent3d_makeDouble(this.swigCPtr, dimension, moveRight);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void makeCube(bool planar)
		{
			GlobalsPINVOKE.Extent3d_makeCube(this.swigCPtr, planar);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Extent3d() : this(GlobalsPINVOKE.new_Extent3d__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Extent3d(OdGePoint3d min, OdGePoint3d max) : this(GlobalsPINVOKE.new_Extent3d__SWIG_1(OdGePoint3d.getCPtr(min), OdGePoint3d.getCPtr(max)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Extent3d(OdGeExtents3d source) : this(GlobalsPINVOKE.new_Extent3d__SWIG_2(OdGeExtents3d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Extent3d(OdGeExtents2d source) : this(GlobalsPINVOKE.new_Extent3d__SWIG_3(OdGeExtents2d.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdSiShape clone()
		{
			OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.Extent3d_clone(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void transform(OdGeMatrix3d arg0)
		{
			GlobalsPINVOKE.Extent3d_transform(this.swigCPtr, OdGeMatrix3d.getCPtr(arg0));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static OdSiShape kOverallSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.Extent3d_kOverallSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdSiShape kNoSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.Extent3d_kNoSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum IntersectResult
		{
			left,
			upon,
			right
		}
	}
}
